import 'package:flutter_magic_planet/model/comic.dart';
import 'package:flutter_magic_planet/module/comic/comic_chapter_list/view.dart';
import 'package:flutter_magic_planet/module/comic/comic_list/view.dart';
import 'package:flutter_magic_planet/module/comic/comic_player/view.dart';
import 'package:flutter_magic_planet/module/main/main_view.dart';
import 'package:get/get.dart';

class AppRouter {
  ///主页面
  static final String main = "/";

  /// 漫画列表
  static final String comic = "/comic";

  static final String comicChapter = "/comic_chapters";

  /// 漫画播放
  static final String comicPlayer = "/comic_player";

  ///别名映射页面
  static final List<GetPage> getPages = [
    GetPage(name: main, page: () => MainPage()),
    GetPage(name: '$comicPlayer/:chapterId', page: () => ComicPlayerPage()),
    GetPage(name: '$comic/:option', page: () => ComicListPage()),
    GetPage(name: '$comicChapter', page: () => ComicChapterListPage()),
  ];

  static void toComicList(String query, String option) {
    String path = '$comic/$option?query=$query';
    print(path);
    Get.toNamed(path);
  }

  static void toComicChapterList(Comic comic) {
    Get.toNamed(comicChapter, arguments: comic);
  }

  static void toComicPlayer(String chapterId) {
    String path = '$comicPlayer/$chapterId';
    Get.toNamed(path, arguments: comic);
  }
}
